package com.zlc.study.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class MultiModelController {

    @Resource(name = "qwen")
    private ChatModel chatModelQwen;

    @Resource(name = "deepseek")
    private ChatModel chatModelDeepSeek;

    @GetMapping(value = "/multimodel/qwen")
    public String qwen(@RequestParam(value = "prompt",defaultValue = "你是谁？")String prompt) {
        System.out.println("通过langchain4j调用模型返回结果：\n" + chatModelQwen.chat(prompt));

        return chatModelQwen.chat(prompt);
    }

    @GetMapping(value = "/multimodel/deepseek")
    public String deepseek(@RequestParam(value = "prompt",defaultValue = "你是谁？")String prompt){
        System.out.println("通过langchain4j调用模型返回结果：\n" + chatModelDeepSeek.chat(prompt));
        return chatModelDeepSeek.chat(prompt);
    }

}

